{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Pose Estimation in Camera\n",
    "- Based on tutorial [Pose Estimation with TensorFlow 2.0](https://medium.com/@gsethi2409/pose-estimation-with-tensorflow-2-0-a51162c095ba)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Import Libraries"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-08-02T01:36:55.787005Z",
     "start_time": "2020-08-02T01:36:49.577066Z"
    }
   },
   "outputs": [],
   "source": [
    "import sys\n",
    "import time\n",
    "import logging\n",
    "import numpy as np\n",
    "import cv2\n",
    "\n",
    "from tf_pose import common\n",
    "from tf_pose.estimator import TfPoseEstimator\n",
    "from tf_pose.networks import get_graph_path, model_wh"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-08-02T01:36:11.620938Z",
     "start_time": "2020-08-02T01:36:11.616612Z"
    }
   },
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Initialization"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-26T22:24:36.102767Z",
     "start_time": "2020-07-26T22:24:36.098389Z"
    }
   },
   "outputs": [],
   "source": [
    "# optional \n",
    "logger = logging.getLogger('TfPoseEstimator-WebCam')\n",
    "logger.setLevel(logging.DEBUG)\n",
    "ch = logging.StreamHandler()\n",
    "ch.setLevel(logging.DEBUG)\n",
    "formatter = logging.Formatter('[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s')\n",
    "ch.setFormatter(formatter)\n",
    "logger.addHandler(ch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-08-01T21:22:24.510722Z",
     "start_time": "2020-08-01T21:22:24.508118Z"
    }
   },
   "outputs": [],
   "source": [
    "fps_time = 0"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Model and TfPose Estimator"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-08-01T21:22:37.234375Z",
     "start_time": "2020-08-01T21:22:37.230433Z"
    }
   },
   "outputs": [],
   "source": [
    "def str2bool(v):\n",
    "    return v.lower() in (\"yes\", \"true\", \"t\", \"1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-08-01T21:22:38.309068Z",
     "start_time": "2020-08-01T21:22:38.305690Z"
    }
   },
   "outputs": [],
   "source": [
    "camera = 1\n",
    "resize = '432x368'     # resize images before they are processed\n",
    "resize_out_ratio = 4.0 # resize heatmaps before they are post-processed\n",
    "model = 'mobilenet_thin'\n",
    "show_process = False\n",
    "tensorrt = False       # for tensorrt process"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-08-01T21:22:41.609884Z",
     "start_time": "2020-08-01T21:22:39.578436Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[2020-08-01 17:22:39,583] [TfPoseEstimator] [INFO] loading graph from /Users/mjrovai/Dropbox/2020/10_Data_Science/50_Computer_Vision/30_Pose_Estimation/tf-pose-estimation/models/graph/mobilenet_thin/graph_opt.pb(default size=432x368)\n",
      "2020-08-01 17:22:39,583 INFO loading graph from /Users/mjrovai/Dropbox/2020/10_Data_Science/50_Computer_Vision/30_Pose_Estimation/tf-pose-estimation/models/graph/mobilenet_thin/graph_opt.pb(default size=432x368)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "TfPoseEstimator/MobilenetV1/Conv2d_0/weights\n",
      "TfPoseEstimator/image\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_0/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_0/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_0/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_0/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_1_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_1_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_1_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_1_pointwise/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_2_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_2_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_2_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_2_pointwise/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_3_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_3_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_3_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_3_pointwise/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_4_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_4_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_4_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_4_pointwise/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_5_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_5_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_5_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_5_pointwise/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_6_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_6_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_6_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_6_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_6_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_6_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_6_pointwise/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_7_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_7_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_7_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_7_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_7_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_7_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_7_pointwise/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_8_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_8_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_8_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_8_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_8_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_8_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_8_pointwise/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_9_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_9_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_9_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_9_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_9_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_9_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_9_pointwise/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_10_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_10_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_10_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_10_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_10_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_10_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_10_pointwise/Relu\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_11_depthwise/depthwise_weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_11_pointwise/weights\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_11_depthwise/depthwise\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_11_pointwise/Conv2D\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_11_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_11_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/MobilenetV1/Conv2d_11_pointwise/Relu\n",
      "TfPoseEstimator/Conv2d_3_pool\n",
      "TfPoseEstimator/feat_concat/axis\n",
      "TfPoseEstimator/feat_concat\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L1_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage1_L2_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_concat/axis\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_concat\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L1_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage2_L2_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_concat/axis\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_concat\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L1_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage3_L2_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_concat/axis\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_concat\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L1_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage4_L2_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_concat/axis\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_concat\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L1_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage5_L2_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_concat/axis\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_concat\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L1_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_1_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_1_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_1_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_1_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_1_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_1_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_1_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_2_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_2_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_2_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_2_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_2_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_2_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_2_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_3_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_3_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_3_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_3_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_3_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_3_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_3_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_4_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_4_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_4_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_4_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_4_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_4_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_4_pointwise/Relu\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_5_depthwise/depthwise_weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_5_pointwise/weights\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_5_depthwise/depthwise\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_5_pointwise/Conv2D\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_5_pointwise/Conv2D_bn_offset\n",
      "TfPoseEstimator/Openpose/MConv_Stage6_L2_5_pointwise/BatchNorm/FusedBatchNorm\n",
      "TfPoseEstimator/Openpose/concat_stage7/axis\n",
      "TfPoseEstimator/Openpose/concat_stage7\n",
      "WARNING:tensorflow:From /Users/mjrovai/opt/anaconda3/envs/Tf2_Py37/lib/python3.7/site-packages/tensorflow/python/ops/resource_variable_ops.py:1666: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "If using Keras pass *_constraint arguments to layers.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2020-08-01 17:22:39,797 WARNING From /Users/mjrovai/opt/anaconda3/envs/Tf2_Py37/lib/python3.7/site-packages/tensorflow/python/ops/resource_variable_ops.py:1666: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "If using Keras pass *_constraint arguments to layers.\n"
     ]
    }
   ],
   "source": [
    "# logger.debug('initialization %s : %s' % (args.model, get_graph_path(args.model)))\n",
    "w, h = model_wh(resize)\n",
    "if w > 0 and h > 0:\n",
    "    e = TfPoseEstimator(get_graph_path(model), target_size=(w, h), trt_bool=False)\n",
    "else:\n",
    "    e = TfPoseEstimator(get_graph_path(model), target_size=(432, 368), trt_bool=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Initiate Cam "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-08-01T21:31:07.273233Z",
     "start_time": "2020-08-01T21:31:06.447116Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#logger.debug('cam read+')\n",
    "cam = cv2.VideoCapture(camera)\n",
    "cam.set(3, w)\n",
    "cam.set(4, h)\n",
    "#logger.info('cam image=%dx%d' % (image.shape[1], image.shape[0]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Camera test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-08-01T21:30:45.665005Z",
     "start_time": "2020-08-01T21:29:57.352286Z"
    }
   },
   "outputs": [],
   "source": [
    "while True:\n",
    "        ret_val, image = cam.read()\n",
    "        cv2.putText(image,\n",
    "                    \"FPS: %f\" % (1.0 / (time.time() - fps_time)),\n",
    "                    (10, 10),  cv2.FONT_HERSHEY_SIMPLEX, 0.5,\n",
    "                    (0, 255, 0), 2)\n",
    "        cv2.imshow('tf-pose-estimation result', image)\n",
    "        fps_time = time.time()\n",
    "        \n",
    "        if cv2.waitKey(1) & 0xFF == ord('q'):\n",
    "            break\n",
    "\n",
    "cam.release()\n",
    "cv2.destroyAllWindows()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-08-01T21:34:33.056941Z",
     "start_time": "2020-08-01T21:31:11.150441Z"
    }
   },
   "outputs": [],
   "source": [
    "while True:\n",
    "    ret_val, image = cam.read()\n",
    "\n",
    "    #logger.debug('image process+')\n",
    "    humans = e.inference(image,\n",
    "                         resize_to_default=(w > 0 and h > 0),\n",
    "                         upsample_size=resize_out_ratio)\n",
    "\n",
    "    #logger.debug('postprocess+')\n",
    "    image = TfPoseEstimator.draw_humans(image, humans, imgcopy=False)\n",
    "\n",
    "    #logger.debug('show+')\n",
    "    cv2.putText(image, \"FPS: %f\" % (1.0 / (time.time() - fps_time)), (10, 10),\n",
    "                cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)\n",
    "    cv2.imshow('tf-pose-estimation result', image)\n",
    "    fps_time = time.time()\n",
    "    if cv2.waitKey(1) & 0xFF == ord('q'):\n",
    "        break\n",
    "    #logger.debug('finished+')\n",
    "\n",
    "cam.release()\n",
    "cv2.destroyAllWindows()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "hide_input": false,
  "kernelspec": {
   "display_name": "Tf2_Py37",
   "language": "python",
   "name": "tf2_py37"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  },
  "nbTranslate": {
   "displayLangs": [
    "*"
   ],
   "hotkey": "alt-t",
   "langInMainMenu": true,
   "sourceLang": "en",
   "targetLang": "fr",
   "useGoogleTranslate": true
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": true,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
